﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;

namespace DataAccess.NHibernateHelper
{
    /// <summary>
    /// A NHibernate-context object which operates on a single-database.
    /// Offers functionality for creating UnitOfWorks for use in e.g
    /// Repositories that uses NHibernate.
    /// To create a custom Context implementation, inherit from this
    /// class and ensure that SessionFactory is assigned in cTor.
    /// </summary>
    public abstract class NHibContext
    {
        protected ISessionFactory SessionFactory { get; set; }

        public NHibSession CreateNewSession()
        {
            return new NHibSession(SessionFactory.OpenSession());
        }
    }

}
